'use strict';
// Copyright 2014 Blueant Inc. All Rights Reserved.

/**
 * @fileoverview 英雄受击次数少于$1次
 * @author sundbcn@gmail.com (sun debing)
 */

var _ = require('lodash');

var EventCondition = function () {

};

/**
 * 验证
 */
EventCondition.prototype.check = function (condition, role_model, soldier_model) {
    var select_soldier_list = soldier_model.getSelectSoldierList();
    if (_.indexOf(select_soldier_list, condition.value_1) == -1) {
        return false;
    }

    var soldier_item = soldier_model.getSoldier(condition.value_1);
    if (!soldier_item) {
        return false;
    }
    if (soldier_item.getStar() >= condition.value_2) {
        return true;
    }
    return false;
};

module.exports = new EventCondition();
